Repository navigation
Batch: 4 changes, one commit each - #28
Merged
Merged
Conversation
…r long host names (#23) When a server rejected every handshake, the error ended with one openssl s_client command per key exchange group the scanner does not offer, and each command repeated the address. The CLI prints up to 500 bytes of a scan error, so a long address pushed the last command past that limit, and its group was named nowhere else. Measured with Go 1.26.3 against local servers: run with GODEBUG=fips140=on,tlsmlkem=0, the error for scanner-target-example.localhost on a five-digit port ended in "-groups SecP256r1MLKEM768 and openssl s_client -connect sca..." and did not name SecP384r1MLKEM1024. Without that setting, a 51-character host name on a five-digit port lost it the same way. When the commands do not all fit, the error now names the groups straight after its first sentence and gives only the commands that fit whole. For both host names above that is the command for the first group, and the errors are 453 and 478 bytes. An error whose commands fit is unchanged: against 127.0.0.1 and ::1 on five-digit ports the CLI prints the same bytes as before. A test builds the error for every host name length the scanner accepts, at ports 443 and 65535, and for the longest name after each of the 256 TLS alert values, and finds each group named within the 500 bytes. The FIPS-mode test also scans a 39-character spelling of 127.0.0.1, and that check failed on the earlier code. Fixes #23
With no --sni and a host name too long for the quantum.minQuantumScore Verify to name twice, the Verify connects to the result's IP. That field was the first address the host name resolved to, recorded before any connection, while the scan's dials move on to the next address when the first one refuses. A TLS 1.3 server listening on 127.0.0.1 only, scanned under cnsa-2.0-2030 as a 213-character .localhost name that resolves to ::1 and then 127.0.0.1, was measured over 127.0.0.1, reported "ip": "::1", and its Fix ended with -connect '[::1]:52144', an address the server was not listening on. Each probe now records the address of every connection that completed a handshake, and the result's IP is the one reached first; when one scan's connections reached more than one address, a scan coverage note names them. The same scan now reports "ip": "127.0.0.1", the text report's IP line reads the same, and the 498-byte Fix ends with -connect 127.0.0.1:50983 -servername <the name> -groups X25519MLKEM768 </dev/null; run as printed, that command reached the server and received its handshake failure alert for the group it does not offer. The scanner test scans localhost served on the last of its loopback addresses only, and the analyzer test repeats the report's scan and checks the Verify; both skip where the name does not resolve to two loopback addresses. A unit test covers the note for more than one address. docs/policies.md and the changelog describe the field. Fixes #24
The service endpoint in --format cbom output was written from the bare host and the port with "https://%s:%d", so a scan of '[::1]:8443' listed https://::1:8443. The endpoint is now built with net.JoinHostPort and net/url, and that scan lists https://[::1]:8443. A zone-scoped address is bracketed too, with the % before its zone written %25: fe80::1%lo0 on port 9 is written https://[fe80::1%25lo0]:9. A host name or an IPv4 address is written as before. TestCBOMEndpointWritesAnIPv6AddressInBrackets fails in its three IPv6 cases on the earlier code and passes in all five with this change. Fixes #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request lands 4 commits in
internal/scanner,internal/analyzer,internal/reporter,pkg/types,cmd/tlsanalyzer,docs/policies.md,README.mdandCHANGELOG.md.Included
Verified on this exact tree
git ls-files --others -- '*_test.go': 0 files;git ls-files -- '*_test.go': 92 filesgo mod verify: all modules verifiedgo build ./...: exit 0go vet ./...: exit 0gofmt -s -l .: 0 files listedgolangci-lint run ./...(2.12.2): 17 issues (errcheck 10, staticcheck 6, unused 1)golangci-lint run --new-from-rev=origin/main ./...: 0 issuesgo test -race -p 4 -count=1 -json -skip '^TestAZoneScopedLinkLocalTargetIsScanned$' ./...(Go 1.26.3): exit 0; 6 packages passed, 0 failed; 399 top-level tests passed, 0 failed, 1 skipped (TestFIPSChildScanNamesTheHybridGroupsItCannotOffer, skip message: "runs in the child process that TestAFIPSBuildWithoutMLKEMNamesTheHybridGroupsItCannotOffer starts"); 527 subtests passed, 0 failed, 0 skippedTestAZoneScopedLinkLocalTargetIsScanned: not run, excluded with-skip(it listens on a link-local IPv6 address)go testcommand on the same tree: 398 top-level tests passed, 1 failed, 1 skipped; the failure wasTestSanitizeForReportCostDoesNotGrowQuadratically, a timing test this batch does not touch, which then passed three times in a row alone with-race -count=3on this tree and onorigin/mainNot included
None
Closes
Fixes #23
Fixes #24
Fixes #26
Fixes #27
How to merge
Rebase and merge, so that each change stays its own commit on
main.